home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / gcl-1.000 / gcl-1 / gcl-1.0 / c / pathname.d < prev    next >
Encoding:
Text File  |  1994-05-07  |  15.1 KB  |  778 lines

  1. /*
  2.  Copyright (C) 1994 M. Hagiya, W. Schelter, T. Yuasa
  3.  
  4. This file is part of GNU Common Lisp, herein referred to as GCL
  5.  
  6. GCL is free software; you can redistribute it and/or modify it under
  7. the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GCL is distributed in the hope that it will be useful, but WITHOUT
  12. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public 
  14. License for more details.
  15.  
  16. You should have received a copy of the GNU Library General Public License 
  17. along with GCL; see the file COPYING.  If not, write to the Free Software
  18. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. /*
  22.     pathname.d
  23.     IMPLEMENTATION-DEPENTENT
  24.  
  25.     This file contains those functions that interpret namestrings.
  26. */
  27.  
  28. #include "include.h"
  29.  
  30.  
  31. object
  32. make_pathname(host, device, directory, name, type, version)
  33. object host, device, directory, name, type, version;
  34. {
  35.     object x;
  36.  
  37.     x = alloc_object(t_pathname);
  38.     x->pn.pn_host = host;
  39.     x->pn.pn_device = device;
  40.     x->pn.pn_directory = directory;
  41.     x->pn.pn_name = name;
  42.     x->pn.pn_type = type;
  43.     x->pn.pn_version = version;
  44.     return(x);
  45. }
  46.  
  47. static
  48. make_one(s, end)
  49. char *s;
  50. int end;
  51. {
  52.     int i;
  53.  
  54. #ifdef UNIX
  55.     for (i = 0;  i < end;  i++)
  56.         token->st.st_self[i] = s[i];
  57. #endif
  58. #ifdef AOSVS
  59.  
  60.  
  61.  
  62. #endif
  63.     token->st.st_fillp = end;
  64.     vs_push(copy_simple_string(token));
  65. }
  66.  
  67. /* !!!!! Bug Fix. NLG */
  68. object
  69. parse_namestring(s, start, end, ep)
  70. object s;
  71. int start, end, *ep;
  72. {
  73.     int i, j, k;
  74.     int d;
  75.     object *vsp;
  76.     object x;
  77.     vs_mark;
  78.  
  79.     vsp = vs_top + 1;
  80.     for (i = j = start;  i < end;  ) {
  81.         if (isspace(s->st.st_self[i]))
  82.             break;
  83. #ifndef IS_DIR_SEPARATOR
  84. #define IS_DIR_SEPARATOR(x) (x == '/')
  85. #endif
  86. #ifdef UNIX
  87.         if (IS_DIR_SEPARATOR(s->st.st_self[i])) {
  88. #endif
  89.  
  90.             if (j == 0 && i == 0) {
  91.                 i++;
  92.                 vs_push(Kroot);
  93.                 j = i;
  94.                 continue;
  95.             }
  96. #ifdef UNIX
  97.             /* BUG FIX by Grant J. Munsey */
  98.             if (i == j) {
  99.                 i++;
  100.                 j = i;
  101.                 continue;
  102.             }
  103.             /* END OF BUG FIX */
  104. #endif
  105. #ifdef AOSVS
  106.  
  107.  
  108. #endif
  109. #ifdef UNIX
  110.             if (i-j == 1 && s->st.st_self[j] == '.') {
  111.                 vs_push(Kcurrent);
  112.             } else if (i-j==2 && s->st.st_self[j]=='.' && s->st.st_self[j+1]=='.') {
  113.                 vs_push(Kparent);
  114.             } else
  115.                 make_one(&s->st.st_self[j], i-j);
  116. #endif
  117. #ifdef AOSVS
  118.  
  119. #endif
  120.             i++;
  121.             j = i;
  122. #ifdef AOSVS
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149. #endif
  150.         } else
  151.             i++;
  152.     }
  153. #ifdef UNIX
  154. /*
  155.     if (i-j == 1 && s->st.st_self[j] == '.') {
  156.         vs_push(Kcurrent);
  157.         j = i;
  158.     } else if (i-j == 2 && s->st.st_self[j] == '.' && s->st.st_self[j+1] == '.') {
  159.         vs_push(Kparent);
  160.         j = i;
  161.     }
  162. */
  163. #endif
  164.     *ep = i;
  165.     vs_push(Cnil);
  166.     while (vs_top > vsp)
  167.         stack_cons();
  168.     if (i == j) {
  169.         /*  no file and no type  */
  170.         vs_push(Cnil);
  171.         vs_push(Cnil);
  172.         goto L;
  173.     }
  174.     for (k = j, d = -1;  k < i;  k++)
  175.         if (s->st.st_self[k] == '.')
  176.             d = k;
  177.     if (d == -1) {
  178.         /*  no file type  */
  179. #ifdef UNIX
  180.         if (i-j == 1 && s->st.st_self[j] == '*')
  181. #endif
  182. #ifdef AOSVS
  183.  
  184. #endif
  185.             vs_push(Kwild);
  186.         else
  187.             make_one(&s->st.st_self[j], i-j);
  188.         vs_push(Cnil);
  189.     } else if (d == j) {
  190.         /*  no file name  */
  191.         vs_push(Cnil);
  192. #ifdef UNIX
  193.         if (i-d-1 == 1 && s->st.st_self[d+1] == '*')
  194. #endif
  195. #ifdef AOSVS
  196.  
  197. #endif
  198.             vs_push(Kwild);
  199.         else
  200.             make_one(&s->st.st_self[d+1], i-d-1);
  201.     } else {
  202.         /*  file name and file type  */
  203. #ifdef UNIX
  204.         if (d-j == 1 && s->st.st_self[j] == '*')
  205. #endif
  206. #ifdef AOSVS
  207.  
  208. #endif
  209.             vs_push(Kwild);
  210.         else
  211.             make_one(&s->st.st_self[j], d-j);
  212. #ifdef UNIX
  213.         if (i-d-1 == 1 && s->st.st_self[d+1] == '*')
  214. #endif
  215. #ifdef AOSVS
  216.  
  217. #endif
  218.             vs_push(Kwild);
  219.         else
  220.             make_one(&s->st.st_self[d+1], i-d-1);
  221.     }
  222. L:
  223.     x
  224.     = make_pathname(Cnil, Cnil,
  225.             vs_top[-3], vs_top[-2], vs_top[-1], Cnil);
  226.     vs_reset;
  227.     return(x);
  228.  
  229. NO:
  230.     *ep = i;
  231.     vs_reset;
  232.     return(OBJNULL);
  233. }
  234.  
  235. object
  236. coerce_to_pathname(x)
  237. object x;
  238. {
  239.     object y;
  240.     int e;
  241.  
  242. L:
  243.     switch (type_of(x)) {
  244.     case t_symbol:
  245.     case t_string:
  246.                 /* !!!!! Bug Fix. NLG */
  247.         y = parse_namestring(x, 0, x->st.st_fillp, &e);
  248.         if (y == OBJNULL || e != x->st.st_fillp)
  249.             goto CANNOT_COERCE;
  250.         return(y);
  251.  
  252.     case t_pathname:
  253.         return(x);
  254.  
  255.     case t_stream:
  256.         switch (x->sm.sm_mode) {
  257.         case smm_input:
  258.         case smm_output:
  259.         case smm_probe:
  260.         case smm_io:
  261.             x = x->sm.sm_object1;
  262.             /*
  263.                 The file was stored in sm.sm_object1.
  264.                 See open.
  265.             */
  266.             goto L;
  267.  
  268.         case smm_synonym:
  269.             x = symbol_value(x->sm.sm_object0);
  270.             goto L;
  271.  
  272.         default:
  273.             goto CANNOT_COERCE;
  274.         }
  275.  
  276.     default:
  277.     CANNOT_COERCE:
  278.         FEerror("~S cannot be coerced to a pathname.", 1, x);
  279.     }
  280. }
  281.  
  282. object
  283. default_device(host)
  284. object host;
  285. {
  286.     return(Cnil);
  287.     /*  not implemented yet  */
  288. }
  289.  
  290. object
  291. merge_pathnames(path, defaults, default_version)
  292. object path, defaults, default_version;
  293. {
  294.     object host, device, directory, name, type, version;
  295.  
  296.     if (path->pn.pn_host == Cnil)
  297.         host = defaults->pn.pn_host;
  298.     else
  299.         host = path->pn.pn_host;
  300.     if (path->pn.pn_device == Cnil)
  301.         if (path->pn.pn_host == Cnil)
  302.             device = defaults->pn.pn_device;
  303.         else if (path->pn.pn_host == defaults->pn.pn_host)
  304.             device = defaults->pn.pn_device;
  305.         else
  306.             device = default_device(path->pn.pn_host);
  307.     else
  308.         device = path->pn.pn_device;
  309.     if (path->pn.pn_directory == Cnil)
  310.         directory = defaults->pn.pn_directory;
  311.     else
  312.         directory = path->pn.pn_directory;
  313.     if (path->pn.pn_name == Cnil)
  314.         name = defaults->pn.pn_name;
  315.     else
  316.         name = path->pn.pn_name;
  317.     if (path->pn.pn_type == Cnil)
  318.         type = defaults->pn.pn_type;
  319.     else
  320.         type = path->pn.pn_type;
  321.     version = Cnil;
  322.     /*
  323.         In this implimentation, version is not counted
  324.     */
  325.     return(make_pathname(host,device,directory,name,type,version));
  326. }
  327.  
  328. /*
  329.     Namestring(x) converts a pathname to a namestring.
  330. */
  331. object
  332. namestring(x)
  333. object x;
  334. {
  335.     int i, j;
  336.     object l, y;
  337.  
  338.     i = 0;
  339.     l = x->pn.pn_directory;
  340.     if (endp(l))
  341.         goto L;
  342.     y = l->c.c_car;
  343.     if (y == Kroot) {
  344. #ifdef UNIX
  345.         token->st.st_self[i++] = '/';
  346. #endif
  347. #ifdef AOSVS
  348.  
  349. #endif
  350.         l = l->c.c_cdr;
  351.     }
  352. #ifdef AOSVS
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366. #endif
  367.     for (;  !endp(l);  l = l->c.c_cdr) {
  368.         y = l->c.c_car;
  369. #ifdef UNIX
  370.         if (y == Kcurrent) {
  371.             token->st.st_self[i++] = '.';
  372.             token->st.st_self[i++] = '/';
  373.             continue;
  374.         } else if (y == Kparent) {
  375.             token->st.st_self[i++] = '.';
  376.             token->st.st_self[i++] = '.';
  377.             token->st.st_self[i++] = '/';
  378.             continue;
  379.         }
  380. #endif
  381.         y = coerce_to_string(y);
  382.         for (j = 0;  j < y->st.st_fillp;  j++)
  383.             token->st.st_self[i++]
  384.             = y->st.st_self[j];
  385. #ifdef UNIX
  386.         token->st.st_self[i++] = '/';
  387. #endif
  388. #ifdef AOSVS
  389.  
  390. #endif
  391.     }
  392. L:
  393.     y = x->pn.pn_name;
  394.     if (y == Cnil)
  395.         goto M;
  396.     if (y == Kwild) {
  397. #ifdef UNIX
  398.         token->st.st_self[i++] = '*';
  399. #endif
  400. #ifdef AOSVS
  401.  
  402. #endif
  403.         goto M;
  404.     }
  405.     if (type_of(y) != t_string)
  406.         FEerror("~S is an illegal pathname name.", 1, y);
  407.     for (j = 0;  j < y->st.st_fillp;  j++)
  408.         token->st.st_self[i++] = y->st.st_self[j];
  409. M:
  410.     y = x->pn.pn_type;
  411.     if (y == Cnil)
  412.         goto N;
  413.     if (y == Kwild) {
  414.         token->st.st_self[i++] = '.';
  415. #ifdef UNIX
  416.         token->st.st_self[i++] = '*';
  417. #endif
  418. #ifdef AOSVS
  419.  
  420. #endif
  421.         goto N;
  422.     }
  423.     if (type_of(y) != t_string)
  424.         FEerror("~S is an illegal pathname name.", 1, y);
  425.     token->st.st_self[i++] = '.';
  426.     for (j = 0;  j < y->st.st_fillp;  j++)
  427.         token->st.st_self[i++] = y->st.st_self[j];
  428. N:
  429.     token->st.st_fillp = i;
  430.     return(copy_simple_string(token));
  431. }
  432.  
  433. object
  434. coerce_to_namestring(x)
  435. object x;
  436. {
  437.     object y;
  438.     int e;
  439.  
  440. L:
  441.     switch (type_of(x)) {
  442.     case t_symbol:
  443.         vs_push(alloc_simple_string(x->s.s_fillp));
  444.         /* By Nick Gall */
  445.         vs_head->st.st_self = alloc_relblock(x->s.s_fillp);
  446.         {
  447.             int i;
  448.             for (i = 0;  i < x->s.s_fillp;  i++)
  449.                 vs_head->st.st_self[i] = x->s.s_self[i];
  450.         }
  451.         return(vs_pop);
  452.  
  453.     case t_string:
  454.         return(x);
  455.  
  456.     case t_pathname:
  457.         return(namestring(x));
  458.  
  459.     case t_stream:
  460.         switch (x->sm.sm_mode) {
  461.         case smm_input:
  462.         case smm_output:
  463.         case smm_probe:
  464.         case smm_io:
  465.             x = x->sm.sm_object1;
  466.             /*
  467.                 The file was stored in sm.sm_object1.
  468.                 See open.
  469.             */
  470.             goto L;
  471.  
  472.         case smm_synonym:
  473.             x = symbol_value(x->sm.sm_object0);
  474.             goto L;
  475.  
  476.         default:
  477.             goto CANNOT_COERCE;
  478.         }
  479.  
  480.     default:
  481.     CANNOT_COERCE:
  482.         FEerror("~S cannot be coerced to a namestring.", 1, x);
  483.     }
  484. }
  485.  
  486. Lpathname()
  487. {
  488.     check_arg(1);
  489.     check_type_or_pathname_string_symbol_stream(&vs_base[0]);
  490.     vs_base[0] = coerce_to_pathname(vs_base[0]);
  491. }
  492.  
  493. @(defun parse_namestring (thing
  494.     &o host
  495.        (defaults `symbol_value(Vdefault_pathname_defaults)`)
  496.     &k start end junk_allowed
  497.     &a x y)
  498.     int s, e, ee;
  499. @
  500.     check_type_or_pathname_string_symbol_stream(&thing);
  501.     check_type_or_pathname_string_symbol_stream(&defaults);
  502.     defaults = coerce_to_pathname(defaults);
  503.     x = thing;
  504. L:
  505.     switch (type_of(x)) {
  506.     case t_symbol:
  507.     case t_string:
  508.         get_string_start_end(x, start, end, &s, &e);
  509.         for (;  s < e && isspace(x->st.st_self[s]);  s++)
  510.             ;
  511.         y
  512.                   /* !!!!! Bug Fix. NLG */
  513.         = parse_namestring(x,
  514.                                    s,
  515.                    e - s,
  516.                    &ee);
  517.         if (junk_allowed == Cnil) {
  518.             for (;  ee < e - s;  ee++)
  519.                 if (!isspace(x->st.st_self[s + ee]))
  520.                     break;
  521.             if (y == OBJNULL || ee != e - s)
  522.                 FEerror("Cannot parse the namestring ~S~%\
  523. from ~S to ~S.",
  524.                     3, x, start, end);
  525.         } else
  526.             if (y == OBJNULL)
  527.                 @(return Cnil `make_fixnum(s + ee)`)
  528.         start = make_fixnum(s + ee);
  529.         break;
  530.  
  531.     case t_pathname:
  532.         y = x;
  533.         break;
  534.  
  535.     case t_stream:
  536.         switch (x->sm.sm_mode) {
  537.         case smm_input:
  538.         case smm_output:
  539.         case smm_probe:
  540.         case smm_io:
  541.             x = x->sm.sm_object1;
  542.             /*
  543.                 The file was stored in sm.sm_object1.
  544.                 See open.
  545.             */
  546.             goto L;
  547.  
  548.         case smm_synonym:
  549.             x = symbol_value(x->sm.sm_object0);
  550.             goto L;
  551.  
  552.         default:
  553.             goto CANNOT_PARSE;
  554.         }
  555.  
  556.     default:
  557.     CANNOT_PARSE:
  558.         FEerror("Cannot parse the namestring ~S.", 1, x);
  559.     }
  560.     if (host != Cnil && y->pn.pn_host != Cnil &&
  561.         host != y->pn.pn_host)
  562.         FEerror("The hosts ~S and ~S do not match.",
  563.             2, host, y->pn.pn_host);
  564.     @(return y start)
  565. @)
  566.  
  567. @(defun merge_pathnames (path
  568.     &o (defaults `symbol_value(Vdefault_pathname_defaults)`)
  569.         (default_version Knewest))
  570. @
  571.     check_type_or_pathname_string_symbol_stream(&path);
  572.     check_type_or_pathname_string_symbol_stream(&defaults);
  573.     path = coerce_to_pathname(path);
  574.     defaults = coerce_to_pathname(defaults);
  575.     @(return `merge_pathnames(path, defaults, default_version)`)
  576. @)
  577.  
  578. @(defun make_pathname (&key host device directory name
  579.                 type version defaults
  580.                &aux x)
  581. @
  582.     if (defaults == Cnil) {
  583.         defaults
  584.         = symbol_value(Vdefault_pathname_defaults);
  585.         defaults = coerce_to_pathname(defaults);
  586.         defaults
  587.         = make_pathname(defaults->pn.pn_host,
  588.                     Cnil, Cnil, Cnil, Cnil, Cnil);
  589.     } else
  590.         defaults = coerce_to_pathname(defaults);
  591.     x = make_pathname(host, device, directory, name, type, version);
  592.     x = merge_pathnames(x, defaults, Cnil);
  593.     @(return x)
  594. @)
  595.  
  596. Lpathnamep()
  597. {
  598.     check_arg(1);
  599.  
  600.     if (type_of(vs_base[0]) == t_pathname)
  601.         vs_base[0] = Ct;
  602.     else
  603.         vs_base[0] = Cnil;
  604. }
  605.  
  606. Lpathname_host()
  607. {
  608.     check_arg(1);
  609.  
  610.     check_type_or_pathname_string_symbol_stream(&vs_base[0]);
  611.     vs_base[0] = coerce_to_pathname(vs_base[0]);
  612.     vs_base[0] = vs_base[0]->pn.pn_host;
  613. }
  614.  
  615. Lpathname_device()
  616. {
  617.     check_arg(1);
  618.  
  619.     check_type_or_pathname_string_symbol_stream(&vs_base[0]);
  620.     vs_base[0] = coerce_to_pathname(vs_base[0]);
  621.     vs_base[0] = vs_base[0]->pn.pn_device;
  622. }
  623.  
  624. Lpathname_directory()
  625. {
  626.     check_arg(1);
  627.  
  628.     check_type_or_pathname_string_symbol_stream(&vs_base[0]);
  629.     vs_base[0] = coerce_to_pathname(vs_base[0]);
  630.     vs_base[0] = vs_base[0]->pn.pn_directory;
  631. }
  632.  
  633. Lpathname_name()
  634. {
  635.     check_arg(1);
  636.  
  637.     check_type_or_pathname_string_symbol_stream(&vs_base[0]);
  638.     vs_base[0] = coerce_to_pathname(vs_base[0]);
  639.     vs_base[0] = vs_base[0]->pn.pn_name;
  640. }
  641.  
  642. Lpathname_type()
  643. {
  644.     check_arg(1);
  645.  
  646.     check_type_or_pathname_string_symbol_stream(&vs_base[0]);
  647.     vs_base[0] = coerce_to_pathname(vs_base[0]);
  648.     vs_base[0] = vs_base[0]->pn.pn_type;
  649. }
  650.  
  651. Lpathname_version()
  652. {
  653.     check_arg(1);
  654.  
  655.     check_type_or_pathname_string_symbol_stream(&vs_base[0]);
  656.     vs_base[0] = coerce_to_pathname(vs_base[0]);
  657.     vs_base[0] = vs_base[0]->pn.pn_version;
  658. }
  659.  
  660. Lnamestring()
  661. {
  662.     check_arg(1);
  663.  
  664.     check_type_or_pathname_string_symbol_stream(&vs_base[0]);
  665.     vs_base[0] = coerce_to_namestring(vs_base[0]);
  666. }
  667.  
  668. Lfile_namestring()
  669. {
  670.     check_arg(1);
  671.  
  672.     check_type_or_pathname_string_symbol_stream(&vs_base[0]);
  673.     vs_base[0] = coerce_to_pathname(vs_base[0]);
  674.     vs_base[0]
  675.     = make_pathname(Cnil, Cnil, Cnil,
  676.                 vs_base[0]->pn.pn_name,
  677.                 vs_base[0]->pn.pn_type,
  678.                 vs_base[0]->pn.pn_version);
  679.     vs_base[0] = namestring(vs_base[0]);
  680. }
  681.  
  682. Ldirectory_namestring()
  683. {
  684.     check_arg(1);
  685.  
  686.     check_type_or_pathname_string_symbol_stream(&vs_base[0]);
  687.     vs_base[0] = coerce_to_pathname(vs_base[0]);
  688.     vs_base[0]
  689.     = make_pathname(Cnil, Cnil,
  690.                 vs_base[0]->pn.pn_directory,
  691.                 Cnil, Cnil, Cnil);
  692.     vs_base[0] = namestring(vs_base[0]);
  693. }
  694.  
  695. Lhost_namestring()
  696. {
  697.     check_arg(1);
  698.  
  699.     check_type_or_pathname_string_symbol_stream(&vs_base[0]);
  700.     vs_base[0] = coerce_to_pathname(vs_base[0]);
  701.     vs_base[0] = vs_base[0]->pn.pn_host;
  702.     if (vs_base[0] == Cnil || vs_base[0] == Kwild)
  703.         vs_base[0] = make_simple_string("");
  704. }
  705.  
  706. @(defun enough_namestring (path
  707.     &o (defaults `symbol_value(Vdefault_pathname_defaults)`))
  708. @
  709.     check_type_or_pathname_string_symbol_stream(&path);
  710.     check_type_or_pathname_string_symbol_stream(&defaults);
  711.     defaults = coerce_to_pathname(defaults);
  712.     path = coerce_to_pathname(path);
  713.     path
  714.     = make_pathname(equalp(path->pn.pn_host, defaults->pn.pn_host) ?
  715.             Cnil : path->pn.pn_host,
  716.                     equalp(path->pn.pn_device,
  717.                    defaults->pn.pn_device) ?
  718.             Cnil : path->pn.pn_device,
  719.                     equalp(path->pn.pn_directory,
  720.                    defaults->pn.pn_directory) ?
  721.             Cnil : path->pn.pn_directory,
  722.                     equalp(path->pn.pn_name, defaults->pn.pn_name) ?
  723.             Cnil : path->pn.pn_name,
  724.                     equalp(path->pn.pn_type, defaults->pn.pn_type) ?
  725.             Cnil : path->pn.pn_type,
  726.                     equalp(path->pn.pn_version,
  727.                    defaults->pn.pn_version) ?
  728.             Cnil : path->pn.pn_version);
  729.     @(return `namestring(path)`)
  730. @)
  731.  
  732. init_pathname()
  733. {
  734.     Vdefault_pathname_defaults =
  735.     make_special("*DEFAULT-PATHNAME-DEFAULTS*",
  736.              make_pathname(Cnil, Cnil, Cnil, Cnil, Cnil, Cnil));
  737.  
  738.     Kwild = make_keyword("WILD");
  739.     Knewest = make_keyword("NEWEST");
  740.  
  741.     Kstart = make_keyword("START");
  742.     Kend = make_keyword("END");
  743.     Kjunk_allowed = make_keyword("JUNK-ALLOWED");
  744.  
  745.     Khost = make_keyword("HOST");
  746.     Kdevice = make_keyword("DEVICE");
  747.     Kdirectory = make_keyword("DIRECTORY");
  748.     Kname = make_keyword("NAME");
  749.     Ktype = make_keyword("TYPE");
  750.     Kversion = make_keyword("VERSION");
  751.     Kdefaults = make_keyword("DEFAULTS");
  752.  
  753.     Kroot = make_keyword("ROOT");
  754.     Kcurrent = make_keyword("CURRENT");
  755.     Kparent = make_keyword("PARENT");
  756.     Kper = make_keyword("PER");
  757. }
  758.  
  759. init_pathname_function()
  760. {
  761.     make_function("PATHNAME", Lpathname);
  762.     make_function("PARSE-NAMESTRING", Lparse_namestring);
  763.     make_function("MERGE-PATHNAMES", Lmerge_pathnames);
  764.     make_function("MAKE-PATHNAME", Lmake_pathname);
  765.     make_function("PATHNAMEP", Lpathnamep);
  766.     make_function("PATHNAME-HOST", Lpathname_host);
  767.     make_function("PATHNAME-DEVICE", Lpathname_device);
  768.     make_function("PATHNAME-DIRECTORY", Lpathname_directory);
  769.     make_function("PATHNAME-NAME", Lpathname_name);
  770.     make_function("PATHNAME-TYPE", Lpathname_type);
  771.     make_function("PATHNAME-VERSION", Lpathname_version);
  772.     make_function("NAMESTRING", Lnamestring);
  773.     make_function("FILE-NAMESTRING", Lfile_namestring);
  774.     make_function("DIRECTORY-NAMESTRING", Ldirectory_namestring);
  775.     make_function("HOST-NAMESTRING", Lhost_namestring);
  776.     make_function("ENOUGH-NAMESTRING", Lenough_namestring);
  777. }
  778.